# Create your views here.
from django.shortcuts import get_object_or_404, render

from django.utils import timezone


# YT项目
from .models import Order
def order_list(request):
    orders = Order.objects.all()
    return render(request,
                  'polls/ytt/list.html',
                  {'orders': orders})
    # return render(request,
    #               'polls/ytt/list.html',
    #               {'orders': orders})
def order_detail(request, year, month, day):
    order = get_object_or_404(Order,
                                created_date__year=year,
                                created_date__month=month,
                                created_date__day=day)
    return render(request,
                  'polls/ytt/detail.html',
                  {'order': order})